<template>
  <div class="w-[1170px]">
    <a-table
      :loading="loading"
      :columns="columns"
      :data="tableData"
      row-key="id"
      :pagination="false"
    >
      <template #handle="{}">
        <a-button type="text" @click="$router.push({ name: 'impairDetail' })">查看详情</a-button>
        <a-button type="text" @click="handleDelEvent">删除</a-button>
      </template>
    </a-table>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { Modal } from '@arco-design/web-vue';

const loading = ref(false);
const tableData = ref([
  {
    id: 2,
    code: 'ZY10020240701142721',
    name: '环境监测数据',
    version: 1,
    rubiao_amount: '0',
    useful_life: '3年',
    asset_spec: '无形资产',
    upload_time: '2024-07-23 14:22:19',
    carrying_amounts: '-40000',
    last_test_amount: '40000'
  }
]);

const columns = [
  { title: '资产编号', dataIndex: 'code' },
  { title: '资产名称', dataIndex: 'name' },
  { title: '已入表金额', dataIndex: 'rubiao_amount' },
  { title: '类别', dataIndex: 'asset_spec' },
  { title: '使用寿命', dataIndex: 'useful_life' },
  { title: '最近测试结果', dataIndex: 'last_test_amount' },
  { title: '上传时间', dataIndex: 'upload_time' },
  {
    title: '操作',
    dataIndex: 'actions',
    width: 150,
    slotName: 'handle'
  }
];

// handleDelEvent
const handleDelEvent = () => {
  Modal.confirm({
    title: 'Warning Notification',
    content:
      'This is a warning description which directly indicates a warning that might need attention.',
    cancelText: '取消',
    okText: '确定'
  });
};
</script>
